package org.example.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import lombok.extern.slf4j.Slf4j;
import org.example.Result;
import org.example.sso.LoginApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class SentinelLinkServiceImpl implements SentinelLinkService{

    @Autowired
    private LoginApi loginApi;


    @SentinelResource(value = "getUserByUserName", blockHandler = "handleException")
    public Result<String> getUserByUserName(String userName) {
        return loginApi.getUser(userName);
    }
}
